package giftmail.controller;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.List;

import org.wuwz.poi.ExcelKit;

import com.google.common.collect.Lists;

import giftmail.model.UserExcel;

public class UserExcelMain {

	public static void main(String[] args) {
		List<UserExcel> users = Lists.newArrayList();
		for (int i = 0; i < 3000; i++) {
			UserExcel e = new UserExcel();
			e.setUid(i + 1);
			e.setUsername("USERNAME_" + (i + 1));
			e.setPassword("asdasdasdasd");
			e.setNickname("NICKNAME_" + (i + 1));
			e.setAge(18);
			users.add(e);
		}

		// 生成本地文件
		//File excelFile = new File("/Users/yanxin/Downloads/excel.xlsx");
		
		File excelFile = new File("D:\\excel.xlsx");
		try {
			ExcelKit.$Builder(UserExcel.class).toExcel(users, "用户信息", new FileOutputStream(excelFile));
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

}
